<template>
  <div class="not-found-view">
    <div class="not-found-container">
      <!-- 404 图标 -->
      <div class="error-icon">
        <div class="number-404">
          <span class="four">4</span>
          <span class="zero">0</span>
          <span class="four">4</span>
        </div>
        <div class="film-reel">
          <div class="reel">
            <div class="hole"></div>
            <div class="hole"></div>
            <div class="hole"></div>
            <div class="hole"></div>
          </div>
          <div class="reel">
            <div class="hole"></div>
            <div class="hole"></div>
            <div class="hole"></div>
            <div class="hole"></div>
          </div>
        </div>
      </div>
      
      <!-- 错误信息 -->
      <div class="error-content">
        <h1 class="error-title">页面未找到</h1>
        <p class="error-message">
          抱歉，您访问的页面不存在或已被移除。
        </p>
        <p class="error-suggestion">
          可能的原因：
        </p>
        <ul class="error-reasons">
          <li>页面地址输入错误</li>
          <li>页面已被删除或移动</li>
          <li>您没有访问权限</li>
          <li>服务器临时故障</li>
        </ul>
      </div>
      
      
      <!-- 操作按钮 -->
      <div class="error-actions">
        <button @click="goBack" class="action-btn secondary">
          <span class="btn-icon">←</span>
          返回上页
        </button>
        
        <router-link to="/" class="action-btn primary">
          <span class="btn-icon">🏠</span>
          回到首页
        </router-link>
        
        <router-link 
          v-if="authStore.isAuthenticated" 
          to="/movies" 
          class="action-btn secondary"
        >
          <span class="btn-icon">🎬</span>
          浏览电影
        </router-link>
        
        <router-link 
          v-else 
          to="/login" 
          class="action-btn secondary"
        >
          <span class="btn-icon">🔑</span>
          登录
        </router-link>
      </div>
      
      <!-- 搜索建议 -->
      <div class="search-suggestion">
        <h3>或者尝试搜索：</h3>
        <div class="quick-links">
          <router-link to="/movies" class="quick-link">
            热门电影
          </router-link>
          <router-link 
            v-if="authStore.isAuthenticated" 
            to="/recommendations" 
            class="quick-link"
          >
            个性推荐
          </router-link>
          <router-link 
            v-if="authStore.isAuthenticated" 
            to="/profile" 
            class="quick-link"
          >
            个人中心
          </router-link>
        </div>
      </div>
      
      <!-- 联系信息 -->
      <div class="contact-info">
        <p class="contact-text">
          如果问题持续存在，请联系我们的技术支持团队。
        </p>
        <div class="contact-methods">
          <a href="mailto:support@movierecommender.com" class="contact-link">
            📧 support@movierecommender.com
          </a>
          <a href="tel:+86-400-123-4567" class="contact-link">
            📞 400-123-4567
          </a>
        </div>
      </div>
    </div>
    
    <!-- 背景装饰 -->
    <div class="background-decoration">
      <div class="floating-element" style="--delay: 0s; --duration: 8s;">
        🎬
      </div>
      <div class="floating-element" style="--delay: 2s; --duration: 10s;">
        🍿
      </div>
      <div class="floating-element" style="--delay: 4s; --duration: 12s;">
        🎭
      </div>
      <div class="floating-element" style="--delay: 6s; --duration: 9s;">
        🎪
      </div>
      <div class="floating-element" style="--delay: 1s; --duration: 11s;">
        🎨
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { useRouter } from 'vue-router'
import { useAuthStore } from '@/stores/auth'

const router = useRouter()
const authStore = useAuthStore()

// 返回上一页
const goBack = () => {
  if (window.history.length > 1) {
    router.go(-1)
  } else {
    router.push('/')
  }
}
</script>

<style scoped>
.not-found-view {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.not-found-container {
  max-width: 600px;
  width: 100%;
  text-align: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  padding: 50px 40px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 10;
}

/* 404 图标样式 */
.error-icon {
  margin-bottom: 30px;
  position: relative;
}

.number-404 {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.number-404 span {
  font-size: 80px;
  font-weight: 900;
  color: #667eea;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  animation: bounce 2s infinite;
}

.number-404 .zero {
  animation-delay: 0.2s;
}

.number-404 .four:last-child {
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

.film-reel {
  display: flex;
  justify-content: center;
  gap: 20px;
}

.reel {
  width: 60px;
  height: 60px;
  background-color: #1e293b;
  border-radius: 50%;
  position: relative;
  animation: rotate 4s linear infinite;
}

.reel:nth-child(2) {
  animation-direction: reverse;
}

@keyframes rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.hole {
  width: 8px;
  height: 8px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
}

.hole:nth-child(1) {
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.hole:nth-child(2) {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.hole:nth-child(3) {
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
}

.hole:nth-child(4) {
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
}

/* 错误内容样式 */
.error-content {
  margin-bottom: 40px;
}

.error-title {
  font-size: 32px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 15px 0;
}

.error-message {
  font-size: 18px;
  color: #64748b;
  margin: 0 0 20px 0;
  line-height: 1.6;
}

.error-suggestion {
  font-size: 16px;
  color: #475569;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.error-reasons {
  text-align: left;
  color: #64748b;
  margin: 0 0 0 20px;
  padding: 0;
}

.error-reasons li {
  margin-bottom: 5px;
  line-height: 1.5;
}

/* 操作按钮样式 */
.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  margin-bottom: 40px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
}

.action-btn.primary {
  background-color: #667eea;
  color: white;
}

.action-btn.primary:hover {
  background-color: #5a67d8;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.action-btn.secondary {
  background-color: #f1f5f9;
  color: #475569;
  border: 2px solid #e2e8f0;
}

.action-btn.secondary:hover {
  background-color: #e2e8f0;
  border-color: #cbd5e1;
  transform: translateY(-2px);
}

.btn-icon {
  font-size: 16px;
}

/* 搜索建议样式 */
.search-suggestion {
  margin-bottom: 30px;
}

.search-suggestion h3 {
  font-size: 18px;
  color: #1e293b;
  margin: 0 0 15px 0;
  font-weight: 600;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.quick-link {
  padding: 8px 16px;
  background-color: #f8fafc;
  color: #667eea;
  text-decoration: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.quick-link:hover {
  background-color: #667eea;
  color: white;
  transform: translateY(-1px);
}

/* 联系信息样式 */
.contact-info {
  border-top: 1px solid #e2e8f0;
  padding-top: 30px;
}

.contact-text {
  color: #64748b;
  margin: 0 0 15px 0;
  font-size: 14px;
}

.contact-methods {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.contact-link {
  color: #667eea;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: color 0.3s ease;
}

.contact-link:hover {
  color: #5a67d8;
}

/* 背景装饰 */
.background-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
}

.floating-element {
  position: absolute;
  font-size: 30px;
  opacity: 0.1;
  animation: float var(--duration) ease-in-out infinite;
  animation-delay: var(--delay);
}

.floating-element:nth-child(1) {
  top: 10%;
  left: 10%;
}

.floating-element:nth-child(2) {
  top: 20%;
  right: 15%;
}

.floating-element:nth-child(3) {
  bottom: 30%;
  left: 5%;
}

.floating-element:nth-child(4) {
  bottom: 10%;
  right: 10%;
}

.floating-element:nth-child(5) {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px) rotate(0deg);
  }
  25% {
    transform: translateY(-20px) rotate(5deg);
  }
  50% {
    transform: translateY(-10px) rotate(-5deg);
  }
  75% {
    transform: translateY(-15px) rotate(3deg);
  }
}

/* 响应式设计 */
@media (max-width: 768px) {
  .not-found-container {
    padding: 30px 20px;
    margin: 10px;
  }
  
  .number-404 span {
    font-size: 60px;
  }
  
  .error-title {
    font-size: 24px;
  }
  
  .error-message {
    font-size: 16px;
  }
  
  .error-actions {
    flex-direction: column;
    align-items: stretch;
  }
  
  .action-btn {
    justify-content: center;
  }
  
  .contact-methods {
    align-items: stretch;
  }
  
  .contact-link {
    text-align: center;
  }
}

@media (max-width: 480px) {
  .number-404 span {
    font-size: 48px;
  }
  
  .film-reel {
    gap: 10px;
  }
  
  .reel {
    width: 40px;
    height: 40px;
  }
  
  .hole {
    width: 6px;
    height: 6px;
  }
  
  .error-title {
    font-size: 20px;
  }
  
  .error-message {
    font-size: 14px;
  }
}
</style>